package com.cuitrip.business.pay;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

import com.cuitrip.service.R;
import com.lab.app.BaseActivity;
import com.lab.app.customui.CustomUiConfig;
import com.lab.app.customui.CustomUiFragmentActivity;

import butterknife.ButterKnife;
import butterknife.Bind;
import butterknife.OnClick;

/**
 * Created by baziii on 15/8/17.
 */
public class PayFailedActivity extends CustomUiFragmentActivity {
    public static final String ERROR_TEXT = "ERROR_TEXT";
    @Bind(R.id.back_tv)
    TextView backTv;
    @Bind(R.id.error_tv)
    TextView errorTv;

    public static void start(Context context, String error) {
        context.startActivity(new Intent(context, PayFailedActivity.class).putExtra(ERROR_TEXT, error));
    }

    /*@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        showActionBar(getString(R.string.pay_operation_pay_feedback_fail));
        setContentView(R.layout.ct_order_pay_failed);
        ButterKnife.bind(this);
        errorTv.setText(getIntent().getStringExtra(ERROR_TEXT));
    }*/

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState,R.layout.ct_order_pay_failed);
    }

    @Override
    public void initView() {
        ButterKnife.bind(this);
        errorTv.setText(getIntent().getStringExtra(ERROR_TEXT));
    }

    @OnClick(R.id.back_tv)
    public void clickBack() {
        finish();
    }

    @Override
    public boolean initCloseTopBar() {
        return false;
    }

    @Override
    public CustomUiConfig initCustomUiConfig() {
        CustomUiConfig config=new CustomUiConfig();
        config.mTopbarLeftAreaName=getString(R.string.back_icon);
        config.mTopbarMiddleAreaName=getString(R.string.pay_operation_pay_feedback_fail);
        return config;
    }

    @Override
    public void onTopbarLeftPress() {
        finish();
    }
}
